package com.conversationboard.api.xml;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

public class XmlUtils {

	private static DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();


	public static Document getDocument(String xml) throws ParserConfigurationException, IOException, SAXException {

		DocumentBuilder builder = factory.newDocumentBuilder();
		Document document = builder.parse(new ByteArrayInputStream(xml.getBytes()));

		return document;
	}

}
